package com.daatak.application.domain;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.daatak.customer.domain.CustomerObject;



@Entity
@Table(name="TMP_APPLICATION") 
public class ApplicationObject {

	@Id
	@GeneratedValue
	@Column(name="APPLICATION_ID") 
	private Integer applicationId;
	
	@Column(name="APPLICATION_TYPE") 
	private String type;
	
	@Column(name="NO_OF_APPLICANT") 
	private Integer noOfApplicant;
	
	@Column(name="APPLICATION_LANGUAGE") 
	private String language;

	
	@Column(name="APPLICATION_TITLE") 
	private String title;
	
	@Column(name="DESCRIPTION") 
	private String description;


	@Column(name="APPLICATION_AMOUNT") 
	private BigDecimal amount;
	
	@Column(name="TERM") //TODO:remove this field from here.	
	private Integer term;
	
	@Column(name="STATUS") 
	private String status;
		
	@Column(name="CREATION_BY") 
	private String createdBy;
	
	@Column(name="CREATION_DATE")
	Date creationDate;
	
	@Column(name="LOCKED_BY")
	private String lockedBy;
	
	@Column(name="LOCKED_STATUS")
	private String lockedStatus;
	
	@OneToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER)
	@JoinColumn(name="REF_ID")
	private Set<CustomerObject> customer=new HashSet<CustomerObject>();
	
	@Column(name="NOTE")
	private String note;//TODO:need to move at different location.
	
	

	public Integer getApplicationId() {
		return applicationId;
	}

	public void setApplicationId(Integer applicationId) {
		this.applicationId = applicationId;
	}



	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public Integer getTerm() {
		return term;
	}

	public void setTerm(Integer term) {
		this.term = term;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public String getLockedBy() {
		return lockedBy;
	}

	public void setLockedBy(String lockedBy) {
		this.lockedBy = lockedBy;
	}

	public String getLockedStatus() {
		return lockedStatus;
	}

	public void setLockedStatus(String lockedStatus) {
		this.lockedStatus = lockedStatus;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Set<CustomerObject> getCustomer() {
		return customer;
	}

	public void setCustomer(Set<CustomerObject> customer) {
		this.customer = customer;
	}

	public Integer getNoOfApplicant() {
		return noOfApplicant;
	}

	public void setNoOfApplicant(Integer noOfApplicant) {
		this.noOfApplicant = noOfApplicant;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	@Override
	public String toString() {
		return "ApplicationObject [applicationId=" + applicationId + ", type="
				+ type + ", noOfApplicant=" + noOfApplicant + ", language="
				+ language + ", title=" + title + ", description="
				+ description + ", amount=" + amount + ", term=" + term
				+ ", status=" + status + ", createdBy=" + createdBy
				+ ", creationDate=" + creationDate + ", lockedBy=" + lockedBy
				+ ", lockedStatus=" + lockedStatus + ", customer=" + customer
				+ "]";
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}
	
	

	
}